/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tesoreria.bc;

import org.cip.esymons.tesoreria.be.FormaPago;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author Ingrid Capunay
 */
public class FormaPagoDelegate {
    private FormaPagoFacadeLocal local;
    public FormaPagoDelegate() {
        local=lookupFormaPagoFacade();
    }
    public void create(FormaPago formaPago){
        local.create(formaPago);
    }

    public void edit(FormaPago formaPago){
        local.edit(formaPago);
    }

    public void remove(FormaPago formaPago){
        local.remove(formaPago);
    }

    public FormaPago find(Object id){
        return local.find(id);
    }

    public List<FormaPago> findAll(){
        return local.findAll();
    }

    public List<FormaPago> paginadorFormaPago(int cantidad, int posicion, String desc){
        return local.paginadorFormaPago(cantidad, posicion, desc);
    }

    public int contarPaginadorFormaPago(String desc){
        return local.contarPaginadorFormaPago(desc);
    }

    private FormaPagoFacadeLocal lookupFormaPagoFacade() {
        try {
            Context c = new InitialContext();
            return (FormaPagoFacadeLocal) c.lookup("java:comp/env/FormaPagoFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
   
}
